<?php

namespace Biz\service\advertisement\apiModule;

use Doraemon\tools\ImgUrl;

class BottomNavTips extends BaseModule
{

    public function format($hit, $uid, $userProfileExt, $statSignExt)
    {

        return $hit ? [
            'url' => empty($hit['pic_id']) ? '' : ImgUrl::getUrl(ImgUrl::APPTYPE_OP, $hit['pic_id'], ImgUrl::IMAGE_SIZE_OP_ORI),
            'instant_id' => (int) $hit['id'],
            'tab_index' => (int) $hit['pos'],
            'statSign' => $this->statSign($hit, $statSignExt),
        ] : null;
    }

    public function extCheckActive($v, $extInput)
    {
        $index = $extInput['pos'] ?: '0';
        $config = $v['ext']['pos'] ?? '';
        $config = explode(',', $config);
        return in_array($index, $config);
    }

}